package com.zhijian.warehouse.manage.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 默认角色枚举类
 *
 * @author HCG
 * @version 1.0
 * @date 2022-10-25
 */
@AllArgsConstructor
@Getter
public enum RoleEnum {

    /**
     * 超级管理员
     */
    SUPER_ADMIN("superAdmin", "超级管理员"),

    /**
     * 老师
     */
    TEACHER("teacher", "老师"),

    /**
     * 学生
     */
    STUDENT("student", "学生");

    private String code;
    private String desc;

    public static RoleEnum getByCode(String code) {
        RoleEnum[] values = RoleEnum.values();
        for (RoleEnum anEnum : values) {
            if (anEnum.getCode().equals(code)) {
                return anEnum;
            }
        }
        return null;
    }

}
